package com.wsd.bookkeeping.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.wsd.bookkeeping.entity.Account;
import com.wsd.bookkeeping.form.InviteForm;
import com.wsd.bookkeeping.form.TransferForm;
import com.wsd.bookkeeping.vo.AccountAdminVO;
import com.wsd.bookkeeping.vo.AccountUserVO;
import com.wsd.bookkeeping.vo.AccountVO;
import com.wsd.bookkeeping.vo.LedgerUserInfo;
import org.springframework.stereotype.Service;

import java.io.FileNotFoundException;
import java.io.OutputStream;
import java.util.List;
import java.util.Map;

@Service
public interface AccountService extends IService<Account> {

    List<AccountVO> queryUserAccountList(Integer userId) throws InterruptedException;

    List<Map<String, Object>> queryUserListByBookId(Integer bookId);

    List<LedgerUserInfo> queryUserInfoListByBookId(Integer bookId);

    AccountAdminVO queryAccountAdminByBookId(Integer bookId);
    List<AccountUserVO> queryAccountUsersByBookId(Integer bookId);

    /**
     * 获取邀请二维码，并写入到输出流
     * @param outputStream 输出流
     */
    void writeInviteImageToOutputStream(InviteForm inviteForm, OutputStream outputStream) throws Exception;

    /**
     * 根据账本ID删除账本
     * @param accountId 账本ID
     * @return 是否成功
     */
    boolean removeAccountById(Integer accountId) throws Exception;

    /**
     * 移交账本管理员权限
     * @param form form
     * @return 是否成功
     */
    boolean transferAuthority(TransferForm form);

    /**
     * 判断账本是否有效
     * @param bookId
     * @return
     */
    boolean isEfficientBook(Integer bookId);
}
